<template>
  <div class="
    white-module">
    <div class="scholl-tabs">
      <el-tabs v-model="activeName">
        <el-tab-pane label="订单列表" name="first"></el-tab-pane>
      </el-tabs>
    </div>
    <el-row class="search-module" >
      <el-form :inline="true" :model="dataForm" @keyup.enter="getDataList()" style="width: 100%">
        <el-col class="search-left" :span="18">
          订单编号：<el-input  v-model="dataForm.name" placeholder="请输入订单编号" />
          <span class="interval"></span>
        </el-col>
        <el-col class="right-btn" :span="6">
          <el-button type="primary"  @click="getDataList()" >查询</el-button>
          <el-button type="default">重置</el-button>
        </el-col>
      </el-form>
    </el-row>
    <div class="global-table">
      <el-table
          :data="dataList"
          :header-cell-style="{
          background: '#F5F7FA',
          color: '#333',
        }"
          style="width: 100%"
      >
        <el-table-column prop="orderId" label="订单编号" />
        <el-table-column prop="productName" label="产品名称" />
        <el-table-column prop="payAmount" label="价格" />
        <el-table-column prop="status" label="状态" >
          <template v-slot="scope">
            <el-tag v-if="scope.row.status === -1" size="small" >已取消</el-tag>
            <el-tag v-else-if="scope.row.status === 0" size="small" type="danger">等待付款</el-tag>
            <el-tag v-else size="small" type="nomarl">已完成</el-tag>
          </template>
        </el-table-column>
        <el-table-column label="操作" width="180">
          <template #default="scope">
            <el-button v-if="scope.row.status === 0" type="text" size="small"> 继续支付 </el-button>
            <el-button v-if="scope.row.status === 1" type="text" size="small"> 申请开票 </el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>

    <el-row class="global-pagination" >
      <el-col :span="8" class="total"> 共搜索 {{total}} 条数据 </el-col>
      <el-col :span="16">
        <el-pagination
            background
            layout="  prev, pager, next, jumper"
            :current-page="page"  :page-sizes="[10, 20, 50, 100]" :page-size="limit"
            :total="total"
            :small="false"
            :disabled="false"
            @size-change="query"
            @current-change="pageCurrentChangeHandle"
        />
      </el-col>
    </el-row>
  </div>
</template>


<script lang="ts" >
import { defineComponent, reactive, toRefs,ref } from "vue";
import listService from "@/service/listService";

export default defineComponent({
  setup() {


    const state = reactive({
      getDataListURL: "/fii/front/center/order/page",
      getDataListIsPage: true,
      deleteURL: "/pay/order",
      isNavCollapse:true,
      activeName:"first",
      deleteIsBatch: true,
      dataForm: {
        orderId: "",
        status: "",
        name: ""
      }
    });
    return { ...listService(state), ...toRefs(state) };
  },

  methods: {
    payHandle(orderId: string) {
      //window.open(`${app.api}/pay/alipay/webPay?orderId=` + orderId);
    }
  }
});
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" >
.search-module {
  display: flex;
  justify-content: space-between;
  padding: 0px 20px 0px 20px;
  margin-top: 10px;
  .interval {
    padding: 0px 15px;
  }

  .search-left {
    color: #333333;
    text-align: left;
  }
  .right-btn {
    text-align: right;
  }
}
.global-table {
  margin-top: 15px;
  padding: 0px 20px;
}

.popper-menu {
  border: 0px !important;
  .el-menu {
    padding: 0px !important;
    background-color: #008fd1 !important;
    .el-menu-item-group__title {
      padding: 0px;
    }
    .el-menu-item:hover {
      background-color: #ffffff !important;
      color: #00a0e9;
    }

    .el-menu-item.is-active {
      background-color: #ffffff !important;
    }
  }
}
</style>
